---
title: gluestack-ui Icon Component | Installation, Usage, and API

description: Icons provide clear, intuitive visual cues for better usability and accessibility in digital products.

pageTitle: Icon

pageDescription: Icons provide clear, intuitive visual cues for better usability and accessibility in digital products.

showHeader: true

tag: RSC
---

import { Meta } from '@storybook/addon-docs';

<Meta title="with-nativewind/Components/Media And Icons/Icon" />

import {
  Center,
  AddIcon,
  CheckIcon,
  CloseIcon,
  InfoIcon,
  ArrowUpIcon,
  ChevronDownIcon,
  ChevronUpIcon,
  ChevronLeftIcon,
  ChevronRightIcon,
  ChevronsLeftIcon,
  ChevronsRightIcon,
  AtSignIcon,
  CheckCircleIcon,
  AlertCircleIcon,
  ChevronsUpDownIcon,
  PaperclipIcon,
  BellIcon,
  MenuIcon,
  ArrowRightIcon,
  ArrowLeftIcon,
  ArrowDownIcon,
  CalendarDaysIcon,
  MessageCircleIcon,
  CopyIcon,
  TrashIcon,
  DownloadIcon,
  GripVerticalIcon,
  EditIcon,
  MailIcon,
  LinkIcon,
  ExternalLinkIcon,
  LockIcon,
  RemoveIcon,
  MoonIcon,
  SlashIcon,
  PhoneIcon,
  HelpCircleIcon,
  RepeatIcon,
  Repeat1Icon,
  SearchIcon,
  SettingsIcon,
  LoaderIcon,
  StarIcon,
  SunIcon,
  ClockIcon,
  UnlockIcon,
  EyeIcon,
  EyeOffIcon,
  CloseCircleIcon,
  ShareIcon,
  CircleIcon,
  FavouriteIcon,
  GlobeIcon,
  ThreeDotsIcon,
  PlayIcon,
  Icon,
  VStack,
  HStack,
  createIcon,
} from '../../core-components/nativewind';
import {
  ChromeIcon,
  InstagramIcon,
  FacebookIcon,
  Camera,
} from 'lucide-react-native';

import { Path, Rect } from 'react-native-svg';
import { CollapsibleCode } from "@gluestack/design-system"
import { transformedCode } from '../../utils';
import {
  AppProvider,
  CodePreview,
  Table,
  TableContainer,
  InlineCode,
  Tabs
} from '@gluestack/design-system';

import Wrapper from '../../core-components/nativewind/Wrapper';

This is an illustration of **Icon** component.

<>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={true}
    metaData={{
      code: `
        <Icon as={EditIcon} {...props} />
      `,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Wrapper,
        Icon,
        EditIcon
      },
      argsType: {
        size: {
          control: 'select',
          options: ['xs', 'sm', 'md', 'lg', 'xl'],
          default: 'md',
        },
      },
    }}
  />
</>

<br />

## Installation

<Tabs value="cli" type="section">
  <Tabs.TabList>
      <Tabs.Tab value="cli">
        <Tabs.TabTitle>CLI</Tabs.TabTitle>
      </Tabs.Tab>
     <Tabs.Tab value="manual">
        <Tabs.TabTitle>Manual</Tabs.TabTitle>
     </Tabs.Tab>
  </Tabs.TabList>
  <Tabs.TabPanels>
    <Tabs.TabPanel value="cli">
<>

### Run the following command:
  ```bash
  npx gluestack-ui add icon
  ```
</>
    </Tabs.TabPanel>
    <Tabs.TabPanel value="manual"> 
<>

### Step 1: Install the following dependencies:
```bash
npm i @gluestack-ui/icon
```

### Step 2: Copy and paste the following code into your project.
<CollapsibleCode>

```jsx 
%%-- File: core-components/nativewind/icon/index.tsx --%% 
```
</CollapsibleCode>

### Step 3: Update the import paths to match your project setup.
</>
    </Tabs.TabPanel>
  </Tabs.TabPanels>
</Tabs>

## API Reference

To use this component in your project, include the following import statement in your file.

```jsx
import { Icon } from '@/components/ui/icon';
```

```jsx
export default () => <Icon as={} />;
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Icon

Pre built icons provided by gluestack-ui inherits all the properties of React Native SVG's [svg](https://github.com/software-mansion/react-native-svg/tree/main/Example) component.

The Icon components inherits all the properties that third party library provides and can be directly applied as props.

### Features

- support of props on any svg icon

### Accessibility

We have outlined the various features that ensure the Icon component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards.

Role: img is passed

### Props

Icon component is created using AsForwarder component from @gluestack-style/react. It extends all the props supported by [gluestack-ui AsForwarder](https://gluestack.io/style/docs/api/as-forwarder) and the props mentioned below.

#### Image

<>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Name</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Value</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>size</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{'2xs | xs | sm | md | lg | xl'}</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>md</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</>

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### All gluestack icons

Below is a list of all of the icons in the library.

<Wrapper>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
      <Center>
  <HStack className="w-[70%] flex flex-wrap">
        <Icon as={AddIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ArrowLeftIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ArrowRightIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ArrowUpIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ArrowDownIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronsLeftIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronsRightIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronsUpDownIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={AtSignIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={PaperclipIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={BellIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CalendarDaysIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={MessageCircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CheckIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronDownIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronUpIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronLeftIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ChevronRightIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CloseIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CopyIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={TrashIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={DownloadIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={GripVerticalIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={EditIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={MailIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ExternalLinkIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={MenuIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={InfoIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={LinkIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={LockIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={RemoveIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={MoonIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={SlashIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CheckCircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={PhoneIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={HelpCircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={RepeatIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={Repeat1Icon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={SearchIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={SettingsIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={LoaderIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={StarIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={SunIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ClockIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={UnlockIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={EyeIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={EyeOffIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={AlertCircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CloseCircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ShareIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={CircleIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={FavouriteIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={GlobeIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={ThreeDotsIcon} className="text-typography-500 m-2 w-4 h-4" />
        <Icon as={PlayIcon} className="text-typography-500 m-2 w-4 h-4" />
  </HStack>
  </Center>
`,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Center,
        Wrapper,
        HStack,
        AddIcon,
        CheckIcon,
        CloseIcon,
        InfoIcon,
        ArrowUpIcon,
        ChevronDownIcon,
        ChevronUpIcon,
        ChevronLeftIcon,
        ChevronRightIcon,
        ChevronsLeftIcon,
        ChevronsRightIcon,
        AtSignIcon,
        CheckCircleIcon,
        AlertCircleIcon,
        ChevronsUpDownIcon,
        PaperclipIcon,
        BellIcon,
        MenuIcon,
        ArrowRightIcon,
        ArrowLeftIcon,
        ArrowDownIcon,
        CalendarDaysIcon,
        MessageCircleIcon,
        CopyIcon,
        TrashIcon,
        DownloadIcon,
        GripVerticalIcon,
        EditIcon,
        MailIcon,
        LinkIcon,
        ExternalLinkIcon,
        LockIcon,
        RemoveIcon,
        MoonIcon,
        SlashIcon,
        PhoneIcon,
        HelpCircleIcon,
        RepeatIcon,
        Repeat1Icon,
        SearchIcon,
        SettingsIcon,
        LoaderIcon,
        StarIcon,
        SunIcon,
        ClockIcon,
        UnlockIcon,
        EyeIcon,
        EyeOffIcon,
        CloseCircleIcon,
        ShareIcon,
        CircleIcon,
        FavouriteIcon,
        GlobeIcon,
        ThreeDotsIcon,
        Icon,
        PlayIcon,
      },
      argsType: {},
    }}
  />
</Wrapper>

#### Lucide Icons (Recommended)

[Lucide](https://lucide.dev/docs/lucide-react-native) is an open source icon library for displaying icons for react-native. `gluestack-ui` provides an easy integration with lucide icons.

<Wrapper>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
      <VStack space="md" className="items-center">
        <Icon className="text-typography-500" as={Camera} />
        <Icon className="text-typography-500" as={ChromeIcon}  />
        <Icon className="text-typography-500" as={InstagramIcon} />
        <Icon className="text-typography-500" as={FacebookIcon} />
      </VStack>
`,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Wrapper,
        VStack,
        ChromeIcon,
        InstagramIcon,
        FacebookIcon,
        Icon,
        Camera,
      },
      argsType: {},
    }}
  />
</Wrapper>

#### SVG & Custom Icons

We can directly create Icon using `createIcon` function exported from `@gluestack-ui/themed` and use it by passing it in `as` prop in `Icon` component.
CreateIcon function takes viewBox, d, path etc as parameters. We can use svgs from other icon libraries like fluent, react-icons etc.

#### SVG & Custom Icons

We can directly create Icon using `createIcon` function exported from `@gluestack-ui/themed` and use it by passing it in `as` prop in `Icon` component.
CreateIcon function takes viewBox, d, path etc as parameters. We can use svgs from other icon libraries like fluent, react-icons etc.

##### Notes to remember while using createIcon function

- Pass svg props such as `viewBox` in `createIcon` directly.
- Copy the svg code without the SVG tag directly into the function argument `Path` or `D` or whichever prop justifies your svg.
- Replace HTML SVG tags (e.g., `<path>`, `<rect>` etc) with the corresponding React Native SVG components (e.g., `<Path>`, `<Rect>` etc).
- For any color property (i.e. fill, stroke etc), if you want to override that color, pass "currentColor" instead of a colorCode.

Before :
`<path fill="#FF0000" d="M10 10L20 20" /> `

After :
`<Path fill="currentColor" d="M10 10L20 20" /> `

<Wrapper>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        const GluestackIcon = createIcon({
          // createIcon function is imported from '@gluestack-ui/themed'
          viewBox: '0 0 32 32',
          path: (
            <>
              {/* Rect, Path is imported from 'react-native-svg' */}
              <Rect width="32" height="32" rx="2" fill="currentColor"/>
              <Path d="M9.5 14.6642L15.9999 9.87633V12.1358L9.5 16.9236V14.6642Z" fill="white"/>
              <Path d="M22.5 14.6642L16.0001 9.87639V12.1359L22.5 16.9237V14.6642Z" fill="white"/>
              <Path d="M9.5 19.8641L15.9999 15.0763V17.3358L9.5 22.1236V19.8641Z" fill="white"/>
              <Path d="M22.5 19.8642L16.0001 15.0764V17.3358L22.5 22.1237V19.8642Z" fill="white"/>
            </>
          ),
        });
      function App () {
        return <Icon as={GluestackIcon} size='xl' className="text-typography-black"/>;
      }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        createIcon,
        Icon,
        Path,
        Rect,
      },
      argsType: {},
    }}
  />
</Wrapper>
